package com.study.www;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.study.www.config.IdWorks;
import com.study.www.entity.Dept;
import com.study.www.web.DeptController;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Map;

@SpringBootApplication
public class Application implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }


    @Override
    public void run(String... args) throws Exception {
        Map<String, Dept> map = Maps.newHashMap();
        Dept dept = new Dept(IdWorks.getId(), "张三", System.currentTimeMillis());
        map.put(dept.getId(),dept);
        dept = new Dept(IdWorks.getId(), "李四", System.currentTimeMillis());
        map.put(dept.getId(),dept);
        dept = new Dept(IdWorks.getId(), "王五", System.currentTimeMillis());
        map.put(dept.getId(),dept);
        dept = new Dept(IdWorks.getId(), "赵六", System.currentTimeMillis());
        map.put(dept.getId(),dept);
        System.out.println(map);
        DeptController.map.putAll(map);
    }
}
